//导入包
var __readline = require("readline-sync");
__readline.setDefaultOptions({ prompt: "" });
var read_line = __readline.prompt;

function printLabel(labelledObj) {
  console.log(labelledObj.label);
}
var myObj = { size: 10, label: "Size 10 Object" };
// printLabel(myObj);
// var a = { name: "s", age: 2 };
// var b = { name: "s", age: 2, sex: "d" };
// a = b;
// console.log(a);

// console.log(Object.prototype.toString.call(null));

// const obj = {
//     z: 1,
//     z2: 2,
//     z3: 3
// }

// console.log(Object.values(obj));

// const map = new Map();
// const weakmap = new WeakMap();

// (function() {
//     const foo = { foo: 1 }
//     const bar = { bar: 1 }
//     map.set(foo, 1)
//     weakmap.set(bar, 1)
// })()
// console.log(map)
// console.log(weakmap)

// console.log([1,11,2,3,23].sort());
function getSequence(arr) {
  const p = arr.slice();
  const result = [0];
  let i, j, u, v, c;
  const len = arr.length;
  for (i = 0; i < len; i++) {
    // 当前顺序取出的元素
    const arrI = arr[i];
    // 排除0的情况
    if (arrI !== 0) {
      // result存储的是长度为i的递增子序列最小末尾值的索引
      j = result[result.length - 1];
      // arr[j]为末尾值，如果满足arr[j]<arrI，那么直接在当前递增子序列后面添加
      if (arr[j] < arrI) {
        // 存储result更新前的最后一个索引的值
        p[i] = j;
        // 存储元素对应的索引值
        result.push(i);
        continue;
      }
      // 不满足则执行二分搜索
      u = 0;
      v = result.length - 1;
      // 查找第一个比arrI小的节点，更新result的值
      while (u < v) {
        // c记录中间的位置
        c = (u + v) >> 1;
        if (arr[result[c]] < arrI) {
          // 若中间的值小于arrI，则在右边
          u = c + 1;
        } else {
          // 更新上沿
          v = c;
        }
      }
      // 找到一个比arrI小的位置u，插入它
      if (arrI < arr[result[u]]) {
        if (u > 0) {
          p[i] = result[u - 1];
        }
        // 存储插入的位置i
        result[u] = i;
      }
    }
  }
  u = result.length;
  v = result[u - 1];
  // 回溯数组p，找到最终的索引
  while (u-- > 0) {
    result[u] = v;
    v = p[v];
  }
  return result;
}
// console.log(getSequence([2, 1, 5, 3, 6, 4, 8, 9, 7]));

class Person {
  constructor(name, age) {
    this.name = name;
    this.age = age;
    // console.log(this)
  }
  sayName() {
    console.log(this.name);
  }
  sayAge() {
    console.log(this.age);
  }
}

class people extends Person {
  constructor(name, age, a) {
    super(name, age);
    this.a = a;
    // console.log(this)
  }
  sayAge() {
    console.log("people age");
  }
}

const people1 = new people("zzd", 13, 2);

// console.log(people1.name)
// console.log(people1.age);
// console.log(people1.a);

let exam = {
  name: "tom",
  age: 24,
  get info() {
    return this.name + this.age;
  },
};

// console.log(Reflect.get(exam, 'name'))

let receiver = {
  name: "jerry",
  age: 20,
};
// console.log(Reflect.get(exam, 'info', receiver))

// const obj = {
//   a:2,
//   b: 4
// }

// Object.defineProperty(obj, 'a', {
//   writable: true,
//   configurable: false,
//   value: 4,
//   enumerable: true
// })

// console.log(obj);
// obj.a = 5
// console.log(obj);

// Object.defineProperty(obj, 'a', {
//   writable: false,
//   configurable: false,
//   value: 4,
//   enumerable: true
// })
// console.log(0.1+0.2);

// console.log(void 0 === undefined);

// function deepCopy(obj) {
//   const res = Array.isArray(obj) ? [] : {};
//   if (obj && typeof obj === "object") {
//     for (let key in obj) {
//       if (obj.hasOwnProperty(key)) {
//         if (obj[key] && typeof obj[key] === "object") {
//           res[key] = deepCopy(obj[key]);
//         } else {
//           res[key] = obj[key];
//         }
//       }
//     }
//   }

//   return res;
// }


function count( s ) {
  // write code here
  let arr = s.split(' '), num = 0
  for(let i = 0; i < arr.length; i++) {
      let cur = arr[i]
      if(i+1 < arr.length && i+2 < arr.length) {
          let second = arr[i+1], third = arr[i+2]
          if(cur == second && second !== third) {
              i = i+2
              let str = cur + cur + third
              num += 1
              console.log(str)
          }
       }
  }
  return num
}
// console.log(count("guan zhu jia ran dun dun jie chan Diana kawaii kawaii kawaii nei"));



// const pingfang = (i) => {
//   let sum = 0
//   while(i > 0) {
//     sum += i*i
//     i--
//   }
//   console.log(sum);
// }
// console.log(pingfang(20))

// function sum() {
//   let res = 0, i = 0
//   while(i < 10) {
//     i++
//     res += i
//   }
//   console.log(res);
// }


// function abc(arr) {
//   let i = 1, sum = 0
//   while(i < 21) {
//     sum += i * arr[i-1]
//     i++
//   }
//   console.log(sum);
// }

// const str = '2084.311706	2256.214742	2378.670144	2637.437092	3261.270052	3851.367489	4374.919142	4970.084458	5003.246988	5096.036323	5340.280955	5688.464384	5573.470504	5537.566561	5490.643477	5522.732348	5500.19996	5667.544476	5709.358498	5524.883424'
// let arr = str.split('\t')
// console.log(arr.length);
// abc(arr)

// let arr = [1,2,3,4,5,10]

// const arrf = arr.filter(item => {
//   if(item < 4) return true
//   else return false
// })
// console.log(arrf);


let strArr = "['a','2','zzd']"
// strArr = strArr.slice(1,-1).replace("'",'')
// console.log(strArr[0]);
// console.log(strArr.length);
// strArr = strArr.replace(/(\[|\])/g,'')
// strArr = strArr.substring(2)
// console.log(strArr);


// let str = 'Mr Blue'
// str = str.replace(/blue/gi,'red')
// console.log(Number('12sd'));22;

// console.log('edc efe if the sdad'.match(/(?=the)/ig));


const rex = /(?=the)/g;
rex.test('redfd is the daddsda')


// console.log('2' == 2);

const obj = { name: 'xiaohui', age: 18, height: undefined }
const { name = 'xxx' } = obj
// console.log(name)

let arr = [1,2,3,4]
// let b = arr.splice(0)
// console.log(arr);
// console.log(b);
let b = arr.slice(0)
console.log(arr);
console.log(b);

